home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr23 / chansw53.zip / CHAINSAW.DOC < prev    next >
Text File  |  1993-05-24  |  35KB  |  925 lines

  1.  
  2.  
  3.  
  4.           
  5.           
  6.           
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.                                     CHAINSAW
  31.  
  32.                      A command line driven directory pruner
  33.  
  34.                        Public Domain, 5/24/93, Ted Davis
  35.  
  36.                                   Version 5.3
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.           
  62.           
  63.           
  64.           
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                                              CHAINSAW: overview
  71.           
  72.           
  73.           CHAINSAW is a command line driven directory pruner.  It does
  74.           not stop for user confirmation and can, therefore, readily
  75.           be used from batch files.  It can generate comprehensive
  76.           reports of its actions.
  77.  
  78.                  It provides optional password protection to prevent
  79.           casual prowlers from using it to accidentally (or
  80.           intentionally) trash a disk or directory.
  81.  
  82.                  CHAINSAW is a cleaning tool, useful for a variety of
  83.           tasks from cleaning out the \temp directory of files,
  84.           subdirectories, or both, to completely wiping an entire disk
  85.           during reconfiguration for a new user.  This program is
  86.           potentially destructive (as is FORMAT) and is intentionally
  87.           somewhat difficult to use in its most destructive modes.  It
  88.           is intended mostly for technicians, system administrators,
  89.           and power users.  It is NOT intended for novice users, who
  90.           are advised to leave it strictly alone.
  91.  
  92.                  The command line contains the complete path,
  93.           including drive, to the directory node at which the pruning
  94.           is to occur, a password (optional) and control switches
  95.           (also optional). Switches are provided to allow the program
  96.           to delete the files in the starting directory, and to remove
  97.           that directory, as well as all the subdirectories and their
  98.           contents, or just the subdirectories.  Other switches enable
  99.           operation on the root directory or network drives.  Another
  100.           group of switches control which of the program's messages
  101.           will be written and whether they go to STDOUT or STDERR.
  102.           Still other switches, used with a somewhat different syntax,
  103.           allow changing the password and default switches.
  104.  
  105.  
  106.                  CHAINSAW is FREEWARE, placed in the public domain
  107.           5/24/93 by the author, Ted Davis: it comes with absolutely
  108.           no warranty and the user's only recourse is refund of the
  109.           purchase price, which is nothing.  If you use this program,
  110.           you do so on your own responsibility.  If you don't want to
  111.           do that, erase your copy of the program RIGHT NOW.
  112.  
  113.  
  114.                  There is no formal support for the program, but you
  115.           do get the source code.  The author is not in a position to
  116.           provide support, but comments are welcome, as are
  117.           suggestions for improvements.  Since addresses and phone
  118.           numbers tend to change, but CompuServe ID numbers are
  119.           forever, I prefer to be contacted via CIS E-mail at
  120.           73500,2314 (but do not expect a quick reply).  If you find
  121.           this program useful, please let me know how you are using
  122.           it, what features you use (and never use), etc.  I know how
  123.           I use it and how my beta testers use it, but the program has
  124.           a lot more in it that we routinely use.
  125.  
  126.  
  127.           
  128.           
  129.           
  130.                                      -1-
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                                      CHAINSAW: syntax, switches
  137.           
  138.           
  139.           SYNTAX (most cases):
  140.  
  141.           CHAINSAW {drive:path} {password} [switches] <Enter>
  142.  
  143.           SYNTAX for changing default switches or password:
  144.  
  145.           CHAINSAW {switch and new data} {password} <Enter>
  146.  
  147.           (No matter what, the password must be the second item in the
  148.           command tail, unless suppressed.)
  149.  
  150.           The default password can be found elsewhere in this manual.
  151.  
  152.           The program responds to Ctrl + C and Ctrl + Break by
  153.           aborting with an ERRORLEVEL of 3 and a warning that some
  154.           damage may have been done to the given directory branch.
  155.  
  156.           ------------------------------------------------------------
  157.  
  158.           SWITCHES, general:
  159.           Switches are introduced by a '/' or '-' character and
  160.           everything in the tail following the marker (except as noted
  161.           above) is considered a switch character or delimiter.  The
  162.           acceptable delimiters are '/', '-', ',', ';',  space, and tab.
  163.           Incorrect or stray characters in the command tail cause the
  164.           program to bomb with an "if you don't know what you are
  165.           doing, don't do it" message.
  166.  
  167.                  In the following sections, the default switches are
  168.           marked with an '*'.
  169.  
  170.                  Switches are processed in the order encountered,
  171.           defaults first, then those from the command tail, which can,
  172.           therefore, override the defaults.
  173.  
  174.  
  175.           SWITCHES, permission:
  176.           These enable or disable operations and locations.
  177.  
  178.           f      Enables deletion of files in the starting directory.
  179.                  It is used to completely clean out a directory rather
  180.                  than just empty and remove its subdirectories.
  181.  
  182.           F  *   Disables deletion of files in the starting directory.
  183.                  It is used to empty and remove the subdirectories of
  184.                  the starting directory while leaving the files in
  185.                  that directory intact.
  186.  
  187.           g      Enables removal of the starting directory as well as
  188.                  all its contents, files as well as subdirectories.
  189.  
  190.           G  *   Disables removal of the starting directory; only its
  191.                  subdirectories, and, optionally, files will be
  192.                  deleted.
  193.           
  194.           
  195.           
  196.                                      -2-
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                              CHAINSAW: switches
  203.           
  204.           
  205.           n      Enables operations on network drives.
  206.  
  207.           N  *   Disables operations on network drives.
  208.  
  209.           p      Enables deletion of read-only, hidden, and system
  210.                  files in all permitted directories.
  211.  
  212.           P  *   Disables deletion of read-only, hidden, and system
  213.                  files in all directories.
  214.  
  215.           r      Enables operations in, but not on, the root
  216.                  directory, if it is the starting path.
  217.  
  218.           R  *   Disables operations in the root directory.
  219.  
  220.  
  221.           SWITCHES, message control
  222.  
  223.  
  224.           ?, h, or H
  225.                  Invokes the help screen, which is a VERY brief
  226.                  syntax and partial switch reminder.  No password is
  227.                  needed with this switch.
  228.  
  229.           b      All messages are written to STDOUT, which can be
  230.                  redirected to a file or device.
  231.  
  232.           B  *   Directs messages to their default destinations:
  233.                  Fatal error messages to STDERR
  234.                  Non-fatal error messages to STDOUT
  235.                  Informational messages to STDOUT
  236.                  File and directory deletion messages are not printed.
  237.  
  238.           d      Enables directory removal listing to STDERR.
  239.  
  240.           D      Enables directory removal listing to STDOUT.
  241.  
  242.           e      Directs all messages to STDERR (the screen), which
  243.                  cannot be redirected.
  244.  
  245.           E      Same as B.
  246.  
  247.           l      Enables listing of deleted files to STDERR.
  248.  
  249.           L      Enables listing of deleted files to STDOUT.
  250.  
  251.           m      Directs all fatal and non-fatal error messages to
  252.                  STDERR without affecting informational and deletion
  253.                  messages.
  254.  
  255.           M      Directs error messages to their default destinations.
  256.  
  257.  
  258.  
  259.           
  260.           
  261.           
  262.                                      -3-
  263.  
  264.  
  265.  
  266.  
  267.                                         
  268.                                                              CHAINSAW: switches
  269.           
  270.           
  271.           o      Directs all fatal and non-fatal error messages to
  272.                  STDOUT without affecting informational and deletion
  273.                  messages.
  274.  
  275.           O      Same as M.
  276.  
  277.           s  *   Enables printing of a summary at termination.
  278.  
  279.           S      Disables printing of the summary.
  280.  
  281.           w  *   Turns the message output routine on.  This is needed
  282.                  only if the default has been changed to W.
  283.  
  284.           W      Turns the message output routine off.  It is used in
  285.                  batch files instead of sending all the messages to
  286.                  STDOUT and redirecting it to NUL.
  287.  
  288.           x      Turns off file deletion failure messages.
  289.  
  290.           X      Turns off directory removal failure messages.
  291.  
  292.  
  293.           SWITCHES, default changing:
  294.  
  295.           For all of these, except 'A', the new data string follows
  296.           the switch character without any delimiter.  If a password
  297.           is needed, it must follow the switch string and be separated
  298.           from it by at least one space.  The switch and string should
  299.           be the first command tail argument, the password, the
  300.           second.  No more than one of these switches can be used at a
  301.           time; the program terminates after processing the first one,
  302.           without even looking to see if there are more (well, almost
  303.           like that, it will process 'a' or 'A' even if the first
  304.           switch is 'z' or 'Z').  Although the default changing syntax
  305.           given above is the preferred form, it is possible to include
  306.           these switches in a normal command tail, but it is a waste
  307.           of effort since all that happens is the default change; the
  308.           program will not change defaults AND prune the directory on
  309.           the same pass.  Note: these write to the executable file,
  310.           but they still work if you rename the working copy of the
  311.           program.
  312.  
  313.           a      Change default switch settings.  The string that
  314.                  follows the 'a' must be a legal switch string, it may
  315.                  contain '/' or '-' characters, but must not contain
  316.                  delimiters, unless the string is quoted.  Anything
  317.                  that would cause the string to be passed as more than
  318.                  one argument will cause an error (bad password).
  319.  
  320.           A      Resets the original default switches, the ones marked
  321.                  with '*' in the preceding sections.
  322.  
  323.  
  324.  
  325.           
  326.           
  327.           
  328.                                      -4-
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                              CHAINSAW: switches
  335.           
  336.           
  337.           z      Changes the password to the string following the 'z'.
  338.                  The next argument must be the existing password, if
  339.                  any.  This switch removes the password if the 'z' is
  340.                  followed immediately by a space.  Lower case 'z'
  341.                  clears the screen to remove the passwords from view.
  342.  
  343.           Z      Exactly like 'z' except that upper case 'Z' does not
  344.                  clear the screen.
  345.  
  346.  
  347.           ------------------------------------------------------------
  348.  
  349.           MESSAGES, general:
  350.           On invocation, the program displays a copyright message to
  351.           STDOUT (unless the default is changed or overridden).  On
  352.           exit it displays a summary, the number of files deleted and
  353.           of directories removed to STDOUT (unless...).  In between,
  354.           it may or may not display some other message or list.
  355.  
  356.                  The messages texts are listed in alphabetical order
  357.           within categories.  Variable text is indicated by <type>.
  358.           The messages are not necessarily in exactly the same format
  359.           as they are on the screen since the screen is assumed to be
  360.           80 columns and this text file is 60 columns wide.
  361.  
  362.                  Note that file and directory removal list messages
  363.           both begin with "... " and removal failure messages begin
  364.           with "*** ".  This allows easy separation and sorting of the
  365.           message stream with various utility programs.
  366.  
  367.                  The rather large number of switches controlling
  368.           message destinations are to allow generation of report files
  369.           with user determined contents.  A typical case would send
  370.           the list of file deletions to redirected STDOUT, suppress
  371.           directory deletion listing, and send everything else to the
  372.           screen (STDERR); another would send the error messages to
  373.           the file, information messages to the screen and suppress
  374.           the deletion messages.  In some batch file applications, any
  375.           message would be useless and all display could be
  376.           suppressed.
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.           
  392.           
  393.           
  394.                                      -5-
  395.  
  396.  
  397.  
  398.  
  399.                                         
  400.                                                              CHAINSAW: messages
  401.           
  402.           
  403.           MESSAGES, informational:
  404.  
  405.           ... Deleted file: <filespec>.
  406.  
  407.                  Indicates that the named file was successfully
  408.                  deleted.  This message must be specifically enabled
  409.                  with the 'l' or 'L' switch.  It is invoked when the C
  410.                  function 'unlink' succeeds.
  411.  
  412.           ... Removed directory: <path>.
  413.  
  414.                  Indicates that the named directory was successfully
  415.                  removed.  This message must be specifically enabled
  416.                  with the 'd' or 'D' switch.  It is invoked when the C
  417.                  function 'rmdir' succeeds.
  418.  
  419.  
  420.           CHAINSAW <version> deletes, without prompts, entire
  421.           branches of a directory tree.
  422.  
  423.           Syntax: CHAINSAW {path to base directory} {password}
  424.           {switches} or CHAINSAW <modification switch> <password> (The
  425.           drive letter is required, trailing '\' is optional.
  426.           Switches may be in /bde, /b/d/e, /b /d /e, /b,/d,/e, -bde, -
  427.           b-d-e, -b -d -e, etc. format, so long as the first one
  428.           immediately follows a '/' or '-'.)
  429.               There are too many switches to define all of them here,
  430.           but... /A restores default switches, /a changes them;
  431.           b,B,d,D,e,E,l,L,m,M,o,O,s,S, w,and W control the way the
  432.           program writes its messages (and what messages it writes).
  433.           For the rest of the listed switches, lower case enables and
  434.           upper case disables the feature: f,F - file deletion in the
  435.           base directory; g,G - base directory removal; n,N -
  436.           operation on network drives; p,P - deletion of read-only,
  437.           hidden and system files; r,R - operation on the root
  438.           directory; See CHAINSAW.DOC for details."
  439.  
  440.                  The help screen is invoked by a '?', 'h', or 'H'
  441.                  switch.
  442.  
  443.           CHAINSAW aborted by user!
  444.           Directory <base path> and its subdirectories are probably
  445.           damaged.
  446.                  Occurs when the user presses Ctrl + Break or
  447.                  Ctrl + C.
  448.  
  449.           Chainsaw deleted <number or "no"> file<s> and removed
  450.           <number or "no"> directories.
  451.  
  452.                  This is the summary message displayed at the end of
  453.                  the program.  Its presence is controlled by the 's'
  454.                  and 'S' switches.
  455.  
  456.  
  457.           
  458.           
  459.           
  460.                                      -6-
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                                              CHAINSAW: messages
  467.           
  468.           
  469.           CHAINSAW...New password installed.
  470.                  This is the success message from the 'z' and 'Z'
  471.                  switches.  It indicates that no errors occurred
  472.                  during the process of encrypting the new password and
  473.                  writing the result to CHAINSAW.EXE.
  474.  
  475.           CHAINSAW Version <version> is FREEWARE, Copyright 1992, Ted
  476.           Davis.
  477.                  This is the copyright message displayed when the
  478.                  program is invoked.   The 'w' and 'W' switches
  479.                  control its presence.
  480.  
  481.           New default switches installed.
  482.                  This is the success message from the 'a' switch.  It
  483.                  indicates that there were no errors during the
  484.                  process of writing the new switch string to
  485.                  CHAINSAW.EXE.  It does not mean that the switch
  486.                  string makes sense or will work.
  487.  
  488.           Original default switches reinstalled.
  489.                  This is the success message from the 'A' switch and
  490.                  means that the original list of default switches has
  491.                  been written to CHAINSAW.EXE.
  492.  
  493.  
  494.           MESSAGES, error:
  495.           Let us hope that you see few or none of these (but you
  496.           will).  Some of these are followed by the appropriate DOS
  497.           error message which can be used to help determine the cause
  498.           of the error (maybe, if you have enough DOS interrupt
  499.           reference material and the message is meaningful).
  500.  
  501.           *** Deletion of file: <filespec> failed.
  502.                  'unlink' failed to execute properly.  The reason is
  503.                  likely to be obscure, perhaps a DOS error, the
  504.                  drive is not erasable or the disk is write protected,
  505.                  or the file is locked by another program on the
  506.                  network.
  507.  
  508.           *** Deletion of file: <filespec> failed.  Error: read-only,
  509.           hidden, or system.
  510.                  The file attributes included one or more of those
  511.                  requiring special permission from the user for
  512.                  deletion.  The 'p' switch enables their deletion and
  513.                  prevents this message, except on write protected or
  514.                  read-only drives.
  515.  
  516.           *** ERROR: <message>.
  517.                  This follows another message and provides what the
  518.                  makers of DOS and of Turbo C++ think of as helpful
  519.                  explanations of a DOS interrupt function failure.
  520.                  These messages are often useless, misleading, and/or
  521.                  cryptic but may be helpful to DOS experts and power
  522.                  users.
  523.           
  524.           
  525.           
  526.                                      -7-
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                                              CHAINSAW: messages
  533.           
  534.           
  535.           *** Removal of directory: <path> failed.
  536.                  'rmdir' failed to execute properly.  The most likely
  537.                  reason is that the directory, or one of its
  538.                  subdirectories is not empty, perhaps due to hidden,
  539.                  read-only, or system files that were not erased
  540.                  because you did not use the 'p' switch or an erasure
  541.                  failure.
  542.  
  543.  
  544.           DOS 3.0 or later is required.
  545.                  This message is self explanatory; the only cure is to
  546.                  upgrade your version of DOS, which you probably
  547.                  should have done anyway when DOS 5.0 came out.
  548.  
  549.           Memory allocation ERROR, CHAINSAW aborted.
  550.                  This means either that the directory tree has too
  551.                  many subdirectories on the branch in work or that a
  552.                  DOS memory allocation error occurred.  CHAINSAW
  553.                  creates (and allocates memory for) a new instance of
  554.                  the 'dirkiller' object for the base directory and for
  555.                  each level of subdirectories within it.  This message
  556.                  occurs when the 'new' operator fails.
  557.  
  558.           Password incorrect of file read error... CHAINSAW aborted.
  559.                  The most usual causes are a typo in the password and
  560.                  omission of all or part of the command tail.  It can
  561.                  also occur if CHAINSAW.EXE becomes corrupted or
  562.                  cannot find itself.
  563.  
  564.           Unable to change password.
  565.                  This means that there was an error writing the new
  566.                  password to CHAINSAW.EXE, or in finding the existing
  567.                  one in the file.  Make sure that CHAINSAW.EXE is not
  568.                  marked read-only, that the disk is not write
  569.                  protected, and if on a network, that you have write
  570.                  permission for the directory in which it resides.  If
  571.                  none of that helps, it will be necessary to start
  572.                  over with an unmodified copy of the program as
  573.                  distributed.
  574.  
  575.           Unable to change switches.
  576.                  This means that there was an error writing the new
  577.                  switches to CHAINSAW.EXE, or in finding the existing
  578.                  ones in the file.  Make sure that CHAINSAW.EXE is not
  579.                  marked read-only, that the disk is not write
  580.                  protected, and if on a network, that you have write
  581.                  permission for the directory in which it resides.  If
  582.                  none of that helps, it will be necessary to start
  583.                  over with an unmodified copy of the program as
  584.                  distributed.
  585.  
  586.  
  587.  
  588.  
  589.           
  590.           
  591.           
  592.                                      -8-
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                                              CHAINSAW: messages
  599.           
  600.           
  601.           The calling syntax for CHAINSAW was incorrect...
  602.           If you do not FULLY understand the syntax and what the
  603.           program does you should not attempt to use it.  This program
  604.           DESTROYS ENTIRE BRANCHES OF THE DIRECTORY TREE.
  605.           If used incorrectly, it can do untold damage.
  606.                  This is the barf message: there was something on, or
  607.                  missing from, the command line that the parser did
  608.                  not like.  Its primary purpose is to discourage
  609.                  browsers while protecting your hard disk(s).  In
  610.                  practice, you will get it most often by forgetting
  611.                  to include the entire command tail when invoking the
  612.                  program: CHAINSAW <Enter> will get it for you.  The
  613.                  absolute minimum command tail contains the complete
  614.                  path, including drive, to the starting directory, and
  615.                  unless you have turned off the password feature, the
  616.                  password.
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.           
  656.           
  657.           
  658.                                      -9-
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                                   CHAINSAW: ERRORLEVELS, SAFETY
  665.           
  666.           
  667.  
  668.           ERRORLEVELS:
  669.           CHAINSAW returns an exit code which can be read and acted
  670.           upon by a calling batch file with the IF ERRORLEVEL test.
  671.  
  672.                  ERRORLEVEL == 0 - Normal termination: everything went
  673.                                    OK, no problems.
  674.                  ERRORLEVEL == 1 - aborted due to some internal error
  675.                                    or command tail syntax error.
  676.                  ERRORLEVEL == 2 - ran to completion, but failed to
  677.                                    delete one or more files or
  678.                                    directories.
  679.                  ERRORLEVEL == 3 - user aborted with Ctrl + Break or
  680.                                    Ctrl + C.
  681.                  ERRORLEVEL == 4 - HELP message was displayed.
  682.                  ERRORLEVEL == 5 - Password or default switches
  683.                                    changed, message indicates success
  684.                                    or failure.
  685.  
  686.           ------------------------------------------------------------
  687.  
  688.           SAFETY and SECURITY:
  689.  
  690.           Most directory pruners either stop and demand confirmation
  691.           from the operator before deleting anything (some prompt for
  692.           everything) or are quick knock-offs that should never leave
  693.           the authors hands.  CHAINSAW is neither.  It is thoroughly
  694.           thought out and tested, and while it does not prompt for
  695.           confirmation, it does have password protection to prevent
  696.           unauthorized use and a rather elaborate set of switches to
  697.           either protect or unprotect such critical areas as the root
  698.           directory; read-only, hidden, and system files; and network
  699.           drives.  For those (such as the target user) who are
  700.           determined to make it easy for casual browsers to trash
  701.           their hard disks, the password feature can be turned off, if
  702.           you have the password.  NOTE: the default password is
  703.           "password" (lower case, no quote marks).  I buried that here
  704.           so that the potential user must at least scan the manual
  705.           before using the program.
  706.  
  707.                  For those users who are concerned about viruses:
  708.           when released, the program was clean, and CIS has a very
  709.           good reputation for virus free software.  Nevertheless,
  710.           the best possible protection is to read, understand, and
  711.           recompile the source code.  It was written using Turbo C++
  712.           PRO (the PRO is important because the inline assembly
  713.           requires TASM and TASM2MSG, which are included in the
  714.           package) with the small memory model.  The only problems to
  715.           be expected with other C++ compilers would be with library
  716.           function names and the inline assembly code.  Most compilers
  717.           have equivalent functions and many have some way to deal
  718.           with inline assembly.  In case yours doesn't, you are on
  719.           your own.  Versions after Beta 5.2 were compiled with
  720.           Borland C++ for DOS.
  721.           
  722.           
  723.           
  724.  
  725.  
  726.                                      -10-
  727.  
  728.  
  729.  
  730.  
  731.  
  732.                                                            CHAINSAW: more about
  733.           
  734.           
  735.  
  736.           More about CHAINSAW:
  737.  
  738.           Most of the code is pure C, but the real business of the
  739.           program, recursion through the directory tree, file
  740.           deletion, and directory removal uses a C++ class named
  741.           'dirkiller' which consists of a data block and a
  742.           constructor.  Construction of the object performs its work.
  743.           When the active instance of dirkiller encounters a
  744.           subdirectory, it creates a new instance of itself to process
  745.           it.  Each instance is destroyed (and removed from memory)
  746.           when it finishes.  This is not true recursion, it is in many
  747.           ways better.  The network drive test is implemented mostly
  748.           in assembly, and is built around DOS interrupt 0x21,
  749.           function 0x44, subfunction 0x09 which reports whether a
  750.           given drive is local or remote.  The source code is heavily
  751.           commented, except for the password changing and reading
  752.           functions.
  753.  
  754.                  The program uses the small memory model, which
  755.           accounts for some of the apparently unneeded code that
  756.           processes the command tail arguments.  They seem to be
  757.           represented by far pointers and cannot be passed to
  758.           functions without a lot of trouble, or a different, and
  759.           slower, memory model.
  760.  
  761.                  This program grew out of a co-worker's need for a
  762.           program to remove a bunch of subdirectories created by a
  763.           batch file.  It needed to work from the batch file without
  764.           operator intervention.  After a bit of research and a lot of
  765.           thinking about the problem, I decided to write a generalized
  766.           command line pruner for public distribution as freeware.
  767.           Obviously, that requires both more features and at least
  768.           some protection from accidental disk trashing.  It grew, and
  769.           grew, and grew.  There are several more features that I
  770.           would like to add, such as a switch to allow exclusion of
  771.           specified sub-branches of the target directory, and another
  772.           to exclude, as non-overrideable defaults, specified
  773.           directories and branches (such as C:\ and C:\DOS); but I had
  774.           to draw the line somewhere.  If there is a demand for them,
  775.           I will produce a version with those, and/or other, features.
  776.           If you want something really customized, I am willing to
  777.           talk money.
  778.  
  779.           T.E.D.  1/11/92
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.           
  790.           
  791.           
  792.                                      -11-
  793.  
  794.  
  795.  
  796.  
  797.  
  798.                                                            CHAINSAW: more about
  799.           
  800.           
  801.                            Addenda 3/4/93 and 5/24/93
  802.  
  803.           This program has been in almost daily use by a PC support
  804.           group (over 50 PCs) for over a year.  Most of the bugs
  805.           have been exterminated and usage patterns have formed and
  806.           have been analyzed. There has been only one change to the
  807.           dirkiller object in over six months, and it was rather minor
  808.           (to handle the special case of removing an already empty
  809.           directory (why anyone would use CHAINSAW instead of
  810.           RD for that completely escapes me)).
  811.  
  812.                   The uses of the program fall into a few distinct
  813.           classes:
  814.                   1)      A password protected copy in the network
  815.                           search path is used mostly to strip out old
  816.                           installations of user software before
  817.                           upgrade or reinstallation and to clean out
  818.                           user's c:\temp directories that get filled
  819.                           up with batch files left by DOSSHELL when
  820.                           the user reboots without dropping the
  821.                           program.  I took over a hundred out of one
  822.                           professor's \temp directory.  CHAINSAW is
  823.                           preferred because it cleans out the
  824.                           directory completely, including removal of
  825.                           subdirectories, which DEL *.*, with its
  826.                           annoying "Are you sure" prompt doesn't do.
  827.  
  828.                   2)      Unprotected copies in the technicians'
  829.                           individual paths (ahead of the global copy)
  830.                           are used frequently for the original purpose
  831.                           of the program: to clean up after shuffling
  832.                           files through a \temp directory.
  833.  
  834.                   3)      We use the same unprotected copies to delete
  835.                           dead directories and unwanted program
  836.                           installations, as after testing a new
  837.                           program.
  838.  
  839.                   4)      An unprotected copy on the same floppy as a
  840.                           batch file is used to remove everything
  841.                           except authorized files from lab and student
  842.                           machines.  The batch file marks the allowed
  843.                           files as read-only and CHAINSAW is not
  844.                           allowed to delete them.  It also writes a
  845.                           report of what it removed and did not remove
  846.                           to STDOUT which is redirected to a data file
  847.                           on the floppy.  The DOS FIND service then
  848.                           separates the removals and non-removals into
  849.                           separate files for analysis.  The batch file
  850.                           also cleans up after itself by removing the
  851.                           read-only marks from those files that are
  852.                           not supposed to be read-only.
  853.  
  854.  
  855.           
  856.           
  857.           
  858.                                      -12-
  859.  
  860.  
  861.  
  862.  
  863.  
  864.                                                            CHAINSAW: more about
  865.           
  866.           
  867.  
  868.                   5)      I use it to strip entire drives down to the
  869.                           volume label in preparation for installing a
  870.                           new version of DOS and a set of standard
  871.                           programs as part of a procedure for
  872.                           refurbishing old machines for new users.
  873.  
  874.                   6)      We also carry it around to non-networked lab
  875.                           machines to clean up students working
  876.                           directories after they graduate (or
  877.                           otherwise leave).  A few of these machines
  878.                           are networked - and we use our own copies or
  879.                           the protected "public" copy instead of
  880.                           carrying a floppy around.
  881.  
  882.  
  883.                    The report generation code, on which I spent so
  884.           much time, is used only during the pre-semester cleanup
  885.           sweep.  The password feature is used only for the copy that
  886.           anyone can access over the network (of course, the other
  887.           copies are either kept filed away on floppies in drawers or
  888.           are protected by our network login passwords).
  889.  
  890.                    I cannot say that the program is perfect or
  891.           bullet proof but, in over a year of use and testing, it has
  892.           never removed anything it wasn't told to remove.  There have
  893.           been malfunctions, but they have all been benign - they
  894.           have resulted in something not being removed or the program
  895.           refusing to do anything at all; these have all been fixed.
  896.           See CHAINSAW.CPP for the version history.
  897.  
  898.                    One or two last notes: I thought it was
  899.           malfunctioning when it refused to remove c:\windows\fungame
  900.           from my own machine at home.  I had momentarily forgotten
  901.           that a SUBST was in effect for that directory (as drive F:).
  902.           DOS refused to let CHAINSAW remove what it thought of as a
  903.           root directory.  Even with the permission switch on, I got
  904.           the general ERROR message with the explanation that access
  905.           was denied.  I did once get a "Protected Mode Violation"
  906.           error from Windows 3.1 (in standard mode on a PS2-30/286),
  907.           but I get those all the time).  No, I will not explain why I
  908.           am trying to support Windows and Windows apps with a brain-
  909.           damaged computer.   The program has not been tested under
  910.           DOS 6.0; we were smart enough to pass on that one, so I
  911.           don't have access to it.
  912.  
  913.           T.E.D.
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.           
  922.           
  923.           
  924.                                      -13-
  925.